Skip to content

Conversation

@steel-bucket
Copy link
Contributor

@steel-bucket steel-bucket commented Aug 24, 2025

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.
  • I have mentioned this change in the changelog.

My familiarity with the project is as follows (check one):

  • I have never used CCExtractor.
  • I have used CCExtractor just a couple of times.
  • I absolutely love CCExtractor, but have not contributed previously.
  • I am an active contributor to CCExtractor.

This PR removes the C code which were ported to Rust already, as discussed in zulip.
This PR also re-makes the entire Mac build.command, as before this, we were always compiling on Mac with DISABLE_RUST on.

@prateekmedia prateekmedia requested a review from Copilot August 24, 2025 15:12
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes C code implementations that have been replaced with Rust equivalents, representing a migration towards Rust-based implementations for various utility functions and features.

  • Removed conditional compilation flags (DISABLE_RUST macros) and associated C fallback implementations
  • Cleaned up build system files to eliminate Rust-optional compilation paths
  • Streamlined codebase by removing deprecated C function implementations that were ported to Rust

Reviewed Changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/lib_ccx/utility.h Removed conditional compilation guards around Rust function declarations
src/lib_ccx/utility.c Removed C implementations of utility functions already ported to Rust
src/lib_ccx/params.c Removed large sections of C parameter parsing functions replaced by Rust
src/lib_ccx/lib_ccx.h Removed DISABLE_RUST conditional compilation for function declarations
src/lib_ccx/hardsubx_*.c Removed hardsubx C implementations replaced by Rust
src/lib_ccx/ccx_encoders_common.c Removed C encoding functions and kept only Rust function calls
src/lib_ccx/ccx_decoders_*.c Removed C decoder implementations in favor of Rust equivalents
src/lib_ccx/cc_bitstream.c Removed C bitstream handling functions replaced by Rust
Build files Removed WITHOUT_RUST and DISABLE_RUST options from build systems

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@hrideshmg
Copy link
Contributor

I'm not sure if this is the same failing option test that you mentioned during the meeting, but it seems that this specific failure is related to this PR. I was able to reproduce it locally.

@steel-bucket
Copy link
Contributor Author

Okay, I'll look into it.

@rboy1
Copy link
Contributor

rboy1 commented Aug 24, 2025

Removing all reference to the old C code would assume that the new RUST code is 100% functional.
This PR would mean it would no longer be able to build the code using C only and would require RUST. Would it make sense to delay this commit after all the changes have been made fully tested by the larger community after a release and tag. That way we have a building it without RUST and still have it fully functional while the RUST bugs are being worked out.

@cfsmp3
Copy link
Contributor

cfsmp3 commented Aug 25, 2025

Removing all reference to the old C code would assume that the new RUST code is 100% functional.

That's what the tests are for.

This PR would mean it would no longer be able to build the code using C only and would require RUST.

Personally I'm OK with this. We have previous versions if someone needs them.

The problem with keeping the C code around is that we can't have clean Rust at the same time. At some point we need to start removing the legacy code, which will force everyone who wants to be up to date use the code we actually want to maintain and use.

@rboy1
Copy link
Contributor

rboy1 commented Aug 25, 2025

The problem with keeping the C code around is that we can't have clean Rust at the same time. At some point we need to start removing the legacy code, which will force everyone who wants to be up to date use the code we actually want to maintain and use.

Fair enough, it would be helpful to create a tag for the last known version to contain C code before this PR is committed so if need be one can check out that tag and build using C. For example, currently RUST doesn't work for OCR but C does. I had to build ccextractor by disabling RUST to get it to work, and still take advantage of the bug fixes since the last release in 2021.

@cfsmp3
Copy link
Contributor

cfsmp3 commented Aug 25, 2025

For example, currently RUST doesn't work for OCR but C does. I had to build ccextractor by disabling RUST to get it to work,

Then we need to fix that. If we keep the old code around then there's no motivation to really solve the problem. But the migration to rust is precisely to address all these things - have a more stable code base that has no segfaults and is better written in general.

@steel-bucket
Copy link
Contributor Author

Hi, I've fixed that one failing regression test in the PR for both linux and windows. Thanks to @hrideshmg for pointing this out.

Copy link
Member

@prateekmedia prateekmedia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ccextractor-bot
Copy link
Collaborator

CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit 3f44115...:
Report Name Tests Passed
Broken 13/13
CEA-708 14/14
DVB 7/7
DVD 3/3
DVR-MS 2/2
General 27/27
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 86/86
Teletext 21/21
WTV 13/13
XDS 34/34

All tests passing on the master branch were passed completely.

Check the result page for more info.

@ccextractor-bot
Copy link
Collaborator

CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit 3f44115...:
Report Name Tests Passed
Broken 13/13
CEA-708 14/14
DVB 7/7
DVD 3/3
DVR-MS 2/2
General 27/27
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 86/86
Teletext 21/21
WTV 13/13
XDS 34/34

Congratulations: Merging this PR would fix the following tests:

  • ccextractor --autoprogram --out=srt --latin1 f1422b8bfe..., Last passed: Never
  • ccextractor --datapid 5603 --autoprogram --out=srt --latin1 --teletext 85c7fc1ad7..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 c0d2fba8c0..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 006fdc391a..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 e92a1d4d2a..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 7e4ebf7fd7..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 9256a60e4b..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 27d7a43dd6..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 297a44921a..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 efbe129086..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 eae0077731..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 e2e2b501e0..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 c6407fb294..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --datets dcada745de..., Last passed: Never
  • ccextractor --autoprogram --out=srt --latin1 --tpage 398 5d5838bde9..., Last passed: Never
  • ccextractor --autoprogram --out=srt --latin1 --teletext --tpage 398 3b276ad8bf..., Last passed: Never

All tests passing on the master branch were passed completely.

Check the result page for more info.

@prateekmedia prateekmedia merged commit ba59eb0 into CCExtractor:master Sep 6, 2025
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants